package dr.board.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dr.controller.Action;
import dr.board.dao.BoardDAO;
import dr.board.domain.Board;

public class UpdateProAction implements Action {

	@Override
	public String execute(HttpServletRequest request, HttpServletResponse response) throws Throwable {
		
		request.setCharacterEncoding("euc-kr");
		String pageNum = request.getParameter("pageNum");
		
		Board article = new Board();
		article.setNum(Integer.parseInt(request.getParameter("num")));
		article.setId(request.getParameter("id"));
        article.setSubject(request.getParameter("subject"));
        article.setContent(request.getParameter("content"));
        article.setPasswd(request.getParameter("passwd"));
        
        BoardDAO dbPro = BoardDAO.getInstance();
        int check = dbPro.updateArticle(article);
        
        request.setAttribute("pageNum", new Integer(pageNum));
        request.setAttribute("check", new Integer(check));
        
		return "/board/updatePro.jsp";
	}

}
